package com.rentong.basic;

import com.rentong.constants.ErrorCodeEnum;

/**
 * @author ZXY
 * @ClassName: BusinessException
 * @Description:
 * @date 2017/10/13 11:03
 */
public class BusinessException extends RuntimeException {
    private static final long serialVersionUID = 4849248628553088432L;

    //异常码
    public String code;

    //异常信息
    public String message;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public BusinessException(String message) {
        this.message = message;
    }

    public BusinessException(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public BusinessException(ErrorCodeEnum errorCodeEnum) {
        this.code = errorCodeEnum.getCode();
        this.message = errorCodeEnum.getMsg();
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
